package com.atstudy.set;

import java.util.Comparator;

/**
 * @version v1.0
 * @description:
 * @author: admin
 * @date: 2023/1/3 14:48
 * @copyright: 博为峰
 */

//比较器
public class ComparatorByAge implements Comparator<Worker> {
    @Override
    public int compare(Worker o1, Worker o2) {
        return o1.getAge() - o2.getAge();
    }
    /*@Override
    public int compare(Object o1, Object o2) {
        Worker w1 = (Worker) o1;
        Worker w2 = (Worker) o2;
        return w1.getAge() - w2.getAge();
    }*/
}
